<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
   <link rel="stylesheet" href="__PUBLIC__/Css/Admin/common.css">
   <link rel="stylesheet" href="__PUBLIC__/Css/Admin/main.css">
   <script type="text/javascript" src="__PUBLIC__/Js/Admin/jquery.min.js"></script>
   <title>编辑景点</title>
   
   <script type="text/javascript">
       $(function(){
    	   // 提交前check
    	   checkBeforeSubmit();
       });
       
       // 提交前check
       function checkBeforeSubmit(){
    	   $("#save_button").click(function(){
    		   // 景点类型ID
    		   var attrTypeId = $("input[name='attrTypeId']").val();
    		   // 景点类型名称
    		   var name = $("input[name='name']").val();
    		   
    		   // 输入check 
    		   if($.trim(name) == ""){
    			   alert("请输入类型名称！");
    			   return false;
    		   }
    		   if($.trim(attrTypeId) == ""){
    			   $.ajax({
    	    			  url:"__URL__/hasAroundTypeName",
    	    			  type:"POST",
    					  async: false,
    					  data: "name=" + $.trim(name),
    					  dataType: "text",
    					  success:function(respData) {
    						   if(respData == "false"){
    							   alert("当前名称的类型已经存在，请输入其他名称！");
    						   } else if(respData == "true"){
    							   $("#attrType_form").submit(); 
    						   }
    					  },
    					  error:function(){
    					    	
    					  }
    	    		   });
    		   } else {
    			   $("#attrType_form").submit(); 
    		   }
    	   });
       }
   </script>
</head>
<body>
<div id="forms" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top">
            	<b class="pl15">{$title}</b>
            	<a class="ext_btn" onclick="location.href='javascript:history.go(-1)'" style="float:right;margin-right:10px;margin-top:5px;">返回</a>
            </div>
            <div class="box_center">
              <form action="{:U('Attraction/saveAroundType')}" class="jqtransform" id="attrType_form" method="post" enctype="multipart/form-data">
                <input type="hidden" name="attrTypeId" value="{$aroundType.id}">
               <table class="form_table pt15 pb15" style="width:100%">
                 <tr>
                  <td class="td_right"><label style="color:red;">*</label>类型名称：</td>
                  <td class=""> 
                    <input type="text" name="name" class="input-text lh30" size="40" value="{$aroundType.name}">
                  </td>
                </tr>
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
                     <input type="button" name="save_button" id="save_button" class="btn btn82 btn_save2" value="保存"> 
                    <input type="reset" name="reset_button" class="btn btn82 btn_res" value="重置">
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
</body>
</html>